package util

import (
	"crypto/md5"
	"fmt"
)

var Md5Util = Md5UtilStruct{}

type Md5UtilStruct struct {
}

func (u *Md5UtilStruct) Encrypt(data []byte) (encrypt string, err error) {
	h := md5.New()
	if _, err = h.Write([]byte(data)); err != nil {
		return "", err
	}
	return fmt.Sprintf("%x", h.Sum(nil)), nil
}
